home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 18306 < prev    next >
Encoding:
Text File  |  1996-08-05  |  938 b   |  43 lines

  1. Path: news.inc.net!it!pendrick
  2. From: pendrick@it.uwp.edu (Richard Pendrick)
  3. Newsgroups: comp.lang.c++
  4. Subject: Q: structures&arrays
  5. Date: 19 Apr 1996 22:25:11 GMT
  6. Organization: University of Wisconsin - Parkside
  7. Message-ID: <4l93s7$9ej@news.inc.net>
  8. NNTP-Posting-Host: 131.210.1.100
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11. I would appreciate it if someone could enlighten me on why the below 
  12. program errors, and what the correct procedure is for initializing an 
  13. array of a structure.
  14. -------------------------------------------------------------
  15. // HELP!
  16.  
  17. #include <iostream.h>
  18.  
  19. struct foo
  20. {
  21.   char n[30];
  22.   int p;
  23. };
  24.  
  25. int main(void)
  26. {
  27.   foo f[5];
  28.  
  29.   f[0] = { "rick", 1 };   // compiler reports "parse error before '{'"
  30.     
  31.   return 0;
  32. }
  33. ---------------------------------------------------------------
  34. Thank you for any help!
  35.  
  36. rickp
  37.  
  38.  
  39.     Good times and riches and son-of-a-bitches,
  40.             I've seen more than I can recall...
  41.                         -J. Buffett
  42.  
  43.